package com.androwit.engine.mapping.converter.str;

import com.androwit.engine.mapping.converter.appender.ValueAppenderConverter;

public class StringAppenderConverter extends
		ValueAppenderConverter<String, String> {
	protected String separator;

	public StringAppenderConverter(String separator) {
		this.separator = separator;
	}

	@Override
	public String fromConverted(String value) throws Exception {
		return value;
	}

	@Override
	public String convert(String value) throws Exception {
		return value;
	}

	@Override
	protected String append(String originalValue, String value) {
		return originalValue != null ? originalValue + separator + value : value;
	}

	public String getSeparator() {
		return separator;
	}

	public void setSeparator(String separator) {
		this.separator = separator;
	}

}
